package swing.samples.jdk6;

import java.awt.BorderLayout;
import java.text.MessageFormat;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

/**   
 * @Title: JDK6TextComponentDemo.java
 * @Description: TODO(添加描述)
 * @author H819
 * @date 2011-1-2 
 * @version V1.0   
 */
public class JDK6TextComponentDemo {
	public static void main(String[] args) throws Exception {
	    final JTextArea textArea = new JTextArea();
	    textArea.setText("text");
	    JScrollPane jScrollPane = new JScrollPane(textArea);
	    final MessageFormat header = new MessageFormat("My Header");
	    final MessageFormat footer = new MessageFormat("My Footer");

	    JPanel contentPane = new JPanel();
	    contentPane.setLayout(new BorderLayout());
	    contentPane.add(jScrollPane, BorderLayout.CENTER);

	    JFrame frame = new JFrame();
	    frame.setTitle("Text-component Printing Demo");
	    frame.setSize(400, 200);
	    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

	    frame.setContentPane(contentPane);
	    frame.setVisible(true);
	    textArea.print(header, footer, true, null, null, true);

	  }
}
